/* 工业视觉后台使用的接口API文件 */

import request from '@/utils/request'
import { ApiModulesRoutes } from '@/consts.js'

/**
 * 查询车间档案管理列表
{
	"pageNo": 0,
	"pageSize": 0,
    "workshopArchivesVO": {
      "name": "",
      "numbering": "",
    }
  }
 */
  export function findWorkshopArchivesPageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/workshopArchives/findWorkshopArchivesPageByParam`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 通过 Id 查询车间档案管理
   * WorkshopArchivesId
   *  * @param {number} WorkshopArchivesId     ID
   */
  export function findWorkshopArchivesById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/workshopArchives/findWorkshopArchivesById`,
      method: 'GET',
      params,
    })
  }

  /**
 * 通过 Id 删除车间档案
 * @param {number} WorkshopArchivesId    ID
 */
   export function delWorkshopArchivesById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/workshopArchives/delWorkshopArchivesById`,
      method: 'GET',
      params,
    })
  }

  /**
 * 添加车间档案
 * @param {string} name
 */
  export function addWorkshopArchives(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/workshopArchives/addWorkshopArchives`,
      method: 'POST',
      data: params,
    })
  }

    /**
 * 添加车间档案
 * @param {string} name
 * @param {number} id
 */
  export function updateWorkshopArchives(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/workshopArchives/updateWorkshopArchives`,
      method: 'POST',
      data: params,
    })
  }
  /**
   * 通过查询条件分页查询产线管理列表
   */
  export function findProductionLinePageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionLine/findProductionLinePageByParam`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 新增产线管理信息
   */
  export function addProductionLine(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionLine/addProductionLine`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 删除产线管理信息
   * @param {string} productionLineId 
   */
  export function delProductionLineById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionLine/delProductionLineById`,
      method: 'GET',
      params,
    })
  }

  /**
  * 查询产线管理信息
  * @param {string} productionLineId 
  */
  export function findProductionLineById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionLine/findProductionLineById`,
      method: 'GET',
      params,
    })
  }

  /**
  * 修改产线管理信息
  * @param {string} productionLineId 
  */
  export function updateProductionLine(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionLine/updateProductionLine`,
      method: 'POST',
      data: params,
    })
  } 

  /**
  * 新增产品类型信息
  * @param {string} productionLineId 
  */
  export function addProductType(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productType/addProductType`,
      method: 'POST',
      data: params,
    })
  } 

  /**
 * 删除产品类型信息
 * @param {string} productTypeId 
 */
  export function delProductTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productType/delProductTypeById`,
      method: 'GET',
      params,
    })
  }

  /**
 * 通过 Id 查询产品类型信息
 * @param {string} productTypeId 
 */
  export function findProductTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productType/findProductTypeById`,
      method: 'GET',
      params,
    })
  }    
    
  /**
  * 通过查询条件分页查询产品类型列表
  *
    "pageNo": 0,
    "pageSize": 10,
    "productTypeVo": {
        "typeName": "",
        "typeNumber": "",
        "unit": "",
        "specification": ""
      }
  */
  export function findProductTypePageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productType/findProductTypePageByParam`,
      method: 'POST',
      data: params,
    })
  }

  /**
  * 修改产品类型信息
  */
   export function updateProductType(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productType/updateProductType`,
      method: 'POST',
      data: params,
    })
  }

  /**
  * 搜索产品列表
      "pageNo": 0,
      "pageSize": 10,
      "productManageVo": {
        "productName": "",
        "productTypeId": ""
      }
  */
   export function findProductManagePageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productManage/findProductManagePageByParam`,
      method: 'POST',
      data: params,
    })
  }

  /**
  * 新增产品
  * @param {string} productName 
  * @param {string} productTypeId
  */
  export function addProductManage(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productManage/addProductManage`,
      method: 'POST',
      data: params,
    })
  }

  /**
  * 修改产品
  * @param {string} id
  * @param {string} productName 
  * @param {string} productTypeId
  */
  export function updateProductManage(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productManage/updateProductManage`,
      method: 'POST',
      data: params,
    })
  }

  /**
 * 查询产品
 * @param {string} productManageId 
 */
   export function getProductManageById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productManage/getProductManageById`,
      method: 'GET',
      params,
    })
  }

/**
 * 删除产品
 * @param {string} productManageId 
 */
  export function delProductManageById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productManage/delProductManageById`,
      method: 'GET',
      params,
    })
  }

    /**
  * 搜索设备列表
    "equipmentVO": {
      "algorithm_id": "",
      "dataStatusName": "",
      "equipment_type_id": "",
      "map_id": "",
      "model": "",
      "name": "",
      "production_line_id": "",
      "state": "",
      "switchState": ""
    },
    "pageNo": 0,
    "pageSize": 15
  */
  export function findEquipmentPageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Equipment/findEquipmentPageByParam`,
      method: 'POST',
      data: params,
    })
  }

 /**
  * 新增设备
  */
  export function addEquipment(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Equipment/addEquipment`,
      method: 'POST',
      data: params,
    })
  }
 
/**
 * 删除设备
 * @param {string} EquipmentId 
 */
 export function delEquipmentById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/Equipment/delEquipmentById`,
    method: 'GET',
    params,
  })
}

  /**
 * 查询设备
 * @param {string} EquipmentId 
 */
   export function findEquipmentById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Equipment/findEquipmentById`,
      method: 'GET',
      params,
    })
  }

  /**
  * 修改产品
  * @param {string} id
  */
  export function updateEquipment(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Equipment/updateEquipment`,
      method: 'POST',
      data: params,
    })
  }

/**
 *
	"pageNo": 10,
	"pageSize": 1,
	"productionLineVo": {
		"productManageIds": "",
		"productManageNames": "",
		"productionLineName": "",
		"productionLineNumber": "",
		"workshopId": ""
 */
  export function aaa(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionLine/findProductionLinePageByParam`,
      method: 'POST',
      data: params,
    })
  }

/**
 * 查询条件分页查询能耗类型列表
 *"": {
		"cycle": "",
		"name": "",
		"unit": "",
		"unitPrice": ""
	},
	"pageNo": 0,
	"pageSize": 0
 */
export function findEnergyConsumptionTypePageByParam(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/EnergyConsumptionType/findEnergyConsumptionTypePageByParam`,
    method: 'POST',
    data: params,
  })
}


/**
 * 添加能耗
 * @param {string} cycle 抄表周期(0 每小时;1 每周一 ;2 每月1日)
 * @param {string} name 类型名
 * @param {string} unit  能耗单位
 * @param {string} unitPrice  每单位价格(元)
 */
  export function addEnergyConsumptionType(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionType/addEnergyConsumptionType`,
      method: 'POST',
      data: params,
    })
  }

  /**
 * 删除能耗
 * @param {string} EnergyConsumptionTypeId 
 */
   export function delEnergyConsumptionTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionType/delEnergyConsumptionTypeById`,
      method: 'GET',
      params,
    })
  }

/**
 * 查询能耗
 * @param {string} EnergyConsumptionTypeId 
 */
  export function findEnergyConsumptionTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionType/findEnergyConsumptionTypeById`,
      method: 'GET',
      params,
    })
  }

  /**
 * genggai能耗
 * @param {string} cycle 抄表周期(0 每小时;1 每周一 ;2 每月1日)
 * @param {string} name 类型名
 * @param {string} unit  能耗单位
 * @param {string} unit_price  每单位价格(元)
 * @param {String} id
 */
   export function updateEnergyConsumptionType(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionType/updateEnergyConsumptionType`,
      method: 'POST',
      data: params,
    })
  }

/**
 * 查询条件分页设备类型
 *"equipmentTypeVO": {
		"name": "",
	},
	"pageNo": 0,
	"pageSize": 12
 */
  export function findEquipmentTypePageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EquipmentType/findEquipmentTypePageByParam`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 设备类型Id查询关联算法列表/
   * @param {string} equipmentTypeId 
   */
   export function findAlgorithmByEquipmentTypeId(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Equipment/findAlgorithmByEquipmentTypeId`,
      method: 'GET',
      params,
    })
  }

  /**
  * 查询条件分页能耗关联
  *"": {
    "cycle": "",
		"dataStatusName": "",
		"name": "",
		"unit": "",
		"unit_price": ""
  },
	"pageNo": 0,
	"pageSize": 12
  */
  export function findEnergyConsumptionRecordingPageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionRecording/findEnergyConsumptionRecordingPageByParam`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 添加能耗關聯
   * @param {string} reading 初始展示數
   * @param {string} balance 余额
   * @param {string} equipmentId 对应设备ID
   * @param {string} typeId 对应的类型ID
   */
  export function addEnergyConsumptionRecording(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionRecording/addEnergyConsumptionRecording`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 添加能耗關聯
   * @param {string} id
   * @param {string} reading 初始展示數
   * @param {string} balance 余额
   * @param {string} equipmentId 对应设备ID
   * @param {string} typeId 对应的类型ID
   */
   export function updateEnergyConsumptionRecording(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionRecording/updateEnergyConsumptionRecording`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 删除对应能耗关联
   * @param {string} EnergyConsumptionRecordingId 
   */
  export function delEnergyConsumptionRecordingById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionRecording/delEnergyConsumptionRecordingById`,
      method: 'GET',
      params,
    })
  }

  /**
   * 应根据ID查询能耗关联
   * @param {string} EnergyConsumptionRecordingId 
   */
   export function findEnergyConsumptionRecordingById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EnergyConsumptionRecording/findEnergyConsumptionRecordingById`,
      method: 'GET',
      params,
    })
  }
    
  /**
  * 算法管理
  *"": {
    "name": "",
    "url": ""
  },
	"pageNo": 0,
	"pageSize": 12
  */
  export function findAlgorithmPageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Algorithm/findAlgorithmPageByParam`,
      method: 'POST',
      data: params,
    })
  }
 
  /**
 * 删除算法
 * @param {string} AlgorithmId 
 */
  export function delAlgorithmById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Algorithm/delAlgorithmById`,
      method: 'GET',
      params,
    })
  }

  /**
 * 查询算法
 * @param {string} AlgorithmId 
 */
   export function findAlgorithmById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Algorithm/findAlgorithmById`,
      method: 'GET',
      params,
    })
  }
  
  /**
 * add算法
 * @param {string} name 名称
 * @param {string} url 算法来源
 * @param {string} remarks 备注说明
 */
  export function addAlgorithm(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Algorithm/addAlgorithm`,
      method: 'POST',
      data: params,
    })
  }
  
  /**
 * update算法
 * @param {string} id
 * @param {string} name 名称
 * @param {string} url 算法来源
 * @param {string} remarks 备注说明
 */
   export function updateAlgorithm(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Algorithm/updateAlgorithm`,
      method: 'POST',
      data: params,
    })
  }

  /**
* 产线ID查产线配置
* @param {string} lineId
*/
export function findProductionProcessByLineId(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/productionProcess/findProductionProcessByLineId`,
    method: 'POST',
    params,
  })
}

  /**
 * 产线ID查产线监控/
 * @param {string} id
 */
  //  export function ProductionProcessMonitor(params) {
  //   return request({
  //     url: `${ApiModulesRoutes.USER}/productionProcess/ProductionProcessMonitor`,
  //     method: 'GET',
  //     params,
  //   })
  // }

  /**
 * 产线配置Id删除一条产线配置
 */
   export function ProductionProcessRemove(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionProcess/ProductionProcessRemove`,
      method: 'GET',
      params,
    })
  }

/** 设备类型ID查询对应的设备列表
 * @param {string} EquipmentTypeId 对应ID
 */
   export function delEquipmentTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Equipment/delEquipmentTypeById`,
      method: 'GET',
      params,
    })
  }

/**
 * 通过产线Id 查询产线监测列表
 */
export function findProductionLineMonitorByLineId(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/ProductionLineMonitor/findProductionLineMonitorByLineId`,
    method: 'GET',
    params,
  })
}



  /**
   * 产线配置修改保存
   */
  export function ProductionProcessEdit(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionProcess/ProductionProcessEdit`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 产线配置添加保存
   */
  export function ProductionProcessSave(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/productionProcess/ProductionProcessSave`,
      method: 'POST',
      data: params,
    })
  }

  /**
   * 批量修改产线监测
   */
   export function updateProductionLineMonitor(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/ProductionLineMonitor/updateProductionLineMonitor`,
      method: 'POST',
      data: params,
    })
  }

  /**
 * 通过产线Id 查询监控设备列表
 */
  export function findEquipmentListByLineId(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/ProductionLineMonitor/findEquipmentListByLineId`,
      method: 'POST',
      data: params,
    })
  }

  // 获取当前部分的组织树
  export function findOrgTree(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/org/findOrgTree`,
      method: 'GET',
      params,
    })
  }

  /**
  * 地图管理
  *"mapVo": {
    "name": "",
    "workshopFilesId": ""
  },
	"pageNo": 0,
	"pageSize": 12
  */
  export function findMapPageByParam(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Map/findMapPageByParam`,
      method: 'POST',
      data: params,
    })
  }


/** 添加地图
 * @param {string} workshopImgId 图片上传对应的ID
 * @param {string} name 图片名称
 * @param {string} orgCode 关联组织
 * @param {string} workshopFilesId 车间编号
 */
   export function addMap(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Map/addMap`,
      method: 'POST',
      data: params,
    })
  }

  /** 修改地图
 * @param {string} id
 * @param {string} workshopImgId 图片上传对应的ID
 * @param {string} name 图片名称
 * @param {string} orgCode 关联组织
 * @param {string} workshopFilesId 车间编号
 */
   export function updateMap(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Map/updateMap`,
      method: 'POST',
      data: params,
    })
  }


  // 删除对应的底图
  export function delMapById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Map/delMapById`,
      method: 'GET',
      params,
    })
  }

  /** 根据ID查询对应的地图
 * @param {string} MapId 图片上传对应的ID
 */
  export function findMapById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/Map/findMapById`,
      method: 'GET',
      params,
    })
  }

/** 获取图片
 * @param {string} fileId 图片上传对应的ID
 */
export function getImgUrl(params) {
  return request({
    url: `${ApiModulesRoutes.BASE}/file/image/preview`,
    method: 'GET',
    params,
  })
}

/** 通过车间ID查询地图定位，车间信息等
 * @param {string} workShopId 对应车间的ID
 */
 export function findMapByWorkShopId(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/Map/findMapByWorkShopId`,
    method: 'GET',
    params,
  })
}

  /** 添加设备类型
 * @param {string} imgId 图片上传对应的ID
 * @param {string} name 图片名称
 * @param {string} orgCode 关联组织
 * @param {string} algorithmId 算法IDs
 * @param {string} note 备注 
 */
  export function addEquipmentType(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EquipmentType/addEquipmentType`,
      method: 'POST',
      data: params,
    })
  }
  
  /** 删除设备类型
 * @param {string} EquipmentTypeId 对应ID
 */
  export function deltypeEquipmentTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EquipmentType/delEquipmentTypeById`,
      method: 'GET',
      params,
    })
  }

  /** 删除设备类型
 * @param {string} EquipmentTypeId 对应ID
 */
  export function findEquipmentTypeById(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EquipmentType/findEquipmentTypeById`,
      method: 'GET',
      params,
    })
  }

/** 修改设备类型
 * @param {string} id
 * @param {string} imgId 图片上传对应的ID
 * @param {string} name 图片名称
 * @param {string} orgCode 关联组织
 * @param {string} algorithmId 算法IDs
 * @param {string} note 备注 
 */
   export function updateEquipmentType(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/EquipmentType/updateEquipmentType`,
      method: 'POST',
      data: params,
    })
  }

  /** 划分地图区域
 * @param {string} bottomLeftX  左侧距离，单位为百分比
 * @param {string} bottomLeftY 头部距离，百分比
 * @param {string} mapId 关联地图
 * @param {string} name
 * @param {string} topRightX 
 * @param {string} topRightY
 */
   export function addmapPositioningId(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/mapPositioningId/addmapPositioningId`,
      method: 'POST',
      data: params,
    })
  }

/** 修改划分地区区域
 * @param {string} id
 * @param {string} bottomLeftX  左侧距离，单位为百分比
 * @param {string} bottomLeftY 头部距离，百分比
 * @param {string} mapId 关联地图
 * @param {string} name
 * @param {string} topRightX 
 * @param {string} topRightY
 */
  export function updatemapPositioningId(params) {
    return request({
      url: `${ApiModulesRoutes.USER}/mapPositioningId/updatemapPositioningId`,
      method: 'POST',
      data: params,
    })
  }

  
/** 根据地图查找对应的划分区域列表
 * @param {string} mapId
 */
 export function findmapPositioningIdByMapId(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/mapPositioningId/findmapPositioningIdByMapId`,
    method: 'GET',
    params,
  })
}

/** 根据地图查找对应的划分区域列表
 * @param {string} mapPositioningId
 */
 export function delmapPositioningIdById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/mapPositioningId/delmapPositioningIdById`,
    method: 'GET',
    params,
  })
}

/** 根据地图查找对应的划分区域列表
 * @param {string} mapPositioningId
 */
 export function findmapPositioningIdById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/mapPositioningId/findmapPositioningIdById`,
    method: 'GET',
    params,
  })
}

